@import '../../style/themes/default.scss';

/* 支持拖拽 */
.ele-modal-movable > .el-dialog > .el-dialog__header {
  cursor: move;
  user-select: none;
}

/* 支持拉伸 */
.ele-modal-resizable > .el-dialog {
  display: flex;
  flex-direction: column;

  &:after {
    content: '';
    position: absolute;
    right: 0;
    bottom: 0;
    width: 12px;
    height: 12px;
    cursor: se-resize;
    background-image: linear-gradient(
      135deg,
      transparent 45%,
      $--color-text-placeholder 0,
      $--color-text-placeholder 55%,
      transparent 0,
      transparent 75%,
      $--color-text-placeholder 0,
      $--color-text-placeholder 85%,
      transparent 0
    );
    background-size: 10px 10px;
    background-position: 0 0;
    background-repeat: no-repeat;
  }
}

.ele-modal-resizable-horizontal > .el-dialog:after {
  cursor: e-resize;
}

.ele-modal-resizable-vertical > .el-dialog:after {
  cursor: s-resize;
}

.ele-modal-resizable,
.ele-modal-wrap-fullscreen {
  & > .el-dialog {
    & > .el-dialog__header {
      flex-shrink: 0;
    }

    & > .el-dialog__body {
      flex: auto;
      overflow: auto;
    }
  }
}

/* 全屏 */
.ele-modal-wrap-fullscreen > .el-dialog {
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  max-width: inherit !important;
  min-width: inherit !important;
  max-height: inherit !important;
  min-height: inherit !important;
  border-radius: 0 !important;
  display: flex !important;
  flex-direction: column;
  margin: 0 !important;

  & > .el-dialog__header {
    cursor: default !important;
  }

  &:after {
    display: none;
  }
}

/* 支持打开多个 */
.ele-modal-multiple {
  pointer-events: none;
}

.ele-modal-container {
  position: relative;
  z-index: 2000;
}

/* 限制在内部区域, 适配各种布局状态 */
.ele-modal-hide {
  display: none !important;
}

.ele-modal-inner {
  top: $--header-height;
  left: $--sidebar-width;
  transition: $--sidebar-transition;
}

.ele-modal-inner-mask {
  background: $--layout-mask-bg;
}

.ele-state-show-tabs.ele-modal-inner {
  top: calc($--header-height + $--tabs-height);
}

.ele-state-collapse.ele-modal-inner {
  left: $--sidebar-collapse-width;
}

.ele-state-side-mix.ele-modal-inner {
  left: calc(
    $--sidebar-nav-width + $--sidebar-width - $--sidebar-collapse-width
  );

  &.ele-state-collapse {
    left: $--sidebar-nav-width;
  }

  &.ele-state-side-mix-single {
    left: $--sidebar-nav-width;
  }
}

.ele-state-nav-collapse.ele-modal-inner {
  left: $--sidebar-width;

  &.ele-state-side-mix-single {
    left: $--sidebar-collapse-width;
  }

  &.ele-state-collapse {
    left: $--sidebar-collapse-width;
  }
}

.ele-state-layout-top.ele-modal-inner {
  left: 0;
}

.ele-state-body-fullscreen.ele-modal-inner {
  top: $--tabs-height;
  left: 0 !important;
}

.ele-state-content-fullscreen.ele-modal-inner {
  top: 0 !important;
}

.ele-state-mobile.ele-modal-inner {
  left: 0 !important;
}

/* 动画修改 */
.ele-modal-inner.dialog-fade-enter-active {
  animation: none;

  & > .el-dialog {
    animation: dialog-fade-in 0.3s;
  }
}

.ele-modal-inner.dialog-fade-leave-active {
  animation: none;

  & > .el-dialog {
    animation: dialog-fade-out 0.3s;
  }
}

/* 垂直居中 */
.ele-modal-centered:not(.ele-modal-wrap-fullscreen) {
  & > .el-dialog {
    vertical-align: middle;
    display: inline-block;
    margin: 0;
    left: var(--modal-centered-left);
  }

  &:before {
    width: 0;
    height: 100%;
    display: inline-block;
    vertical-align: middle;
    content: '';
  }
}

/* 兼容旧版本指令方式使用 */
[ele-movable].el-dialog__wrapper > .el-dialog > .el-dialog__header {
  cursor: move;
  user-select: none;
}

[ele-resizable].el-dialog__wrapper > .el-dialog {
  display: flex;
  flex-direction: column;

  & > .el-dialog__header {
    flex-shrink: 0;
  }

  & > .el-dialog__body {
    flex: auto;
    overflow: auto;
  }

  &:after {
    content: '';
    position: absolute;
    right: 0;
    bottom: 0;
    width: 10px;
    height: 10px;
    cursor: se-resize;
  }
}

.ele-dialog-wrap-fullscreen > .el-dialog {
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  max-width: inherit;
  border-radius: 0;

  & > .el-dialog__header {
    cursor: default !important;
  }

  &:after {
    display: none;
  }
}
